/*
package org.example.spring.self.demo;

import org.example.spring.self.demo.service.OrderService;
import org.example.spring.self.demo.service.UserService;
import org.springframework.cglib.core.DebuggingClassWriter;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import java.lang.reflect.Field;
import java.util.Properties;

public class Test {

	public static void main(String[] args) throws Exception {
		System.out.println(System.getProperty("user.dir"));
		// 开启 保存cglib生成的动态代理类类文件
		saveGeneratedCGlibProxyFiles(System.getProperty("user.dir"));

		AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(AppConfig.class);
		// bean 对象
		UserService userService = (UserService) context.getBean("userService");
		OrderService orderService = (OrderService) context.getBean("orderService");

		orderService.test();

		*/
/*for (Field declaredField : userService.getClass().getDeclaredFields()) {
			if (declaredField.isAnnotationPresent(Autowired.class)) {
				declaredField.setAccessible(true);
				declaredField.set(userService, );
			}
		}

		for (Method declaredMethod : userService.getClass().getDeclaredMethods()) {
			if (declaredMethod.isAnnotationPresent(PostConstruct.class)) {
				declaredMethod.setAccessible(true);
				try {
					declaredMethod.invoke(userService, null);
				} catch (IllegalAccessException e) {
					e.printStackTrace();
				} catch (InvocationTargetException e) {
					e.printStackTrace();
				}
			}
		}*//*

	}

	*/
/**
	 * 设置保存Cglib代理生成的类文件。
	 *
	 * @throws Exception
	 *//*

	public static void saveGeneratedCGlibProxyFiles(String dir) throws Exception {
		Field field = System.class.getDeclaredField("props");
		field.setAccessible(true);
		Properties props = (Properties) field.get(null);
		// dir为保存文件路径
		System.setProperty(DebuggingClassWriter.DEBUG_LOCATION_PROPERTY, dir);
		props.put("net.sf.cglib.core.DebuggingClassWriter.traceEnabled", "true");
	}

}
*/
